package org.primefaces.examples.moviecollector.service;

import java.util.List;
import java.util.Map;

import javax.swing.SortOrder;

import org.primefaces.examples.moviecollector.dao.EventoDAO;
import org.primefaces.examples.moviecollector.domain.Eventos;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;



@Service("eventosService")
public class EventosServiceImpl implements EventosService {
	
	private  EventoDAO eventDao;


	@Autowired
	public EventosServiceImpl(EventoDAO eventDao) {
		
		this.eventDao = eventDao;
	}

	@Transactional
	public void guardarEvento(Eventos evet) {
		eventDao.persist(evet);
		
	}

	@Transactional(readOnly=true)
	public List<Eventos> findAll() {
		return eventDao.loadAll();
	}

	@Transactional(readOnly=true)
	public List<Eventos> findByName(String name) {
		return eventDao.findByNombre(name);
	}

	@Transactional
	public void update(Eventos evet) {
	
		eventDao.update(evet);
		
	}

	@Transactional
	public void remove(Eventos evet) {
		eventDao.delete(evet);
		
	}

	@Transactional(readOnly=true)
	public Eventos findById(Long id) {
		return eventDao.loadById(id);
	}

	public List<Eventos> loadLazy(int first, int pageSize,
			String sortField, SortOrder sortOrder, Map<String, String> filters) {
		// TODO Auto-generated method stub
		return null;
	}

	
	

}
